<template>
  <div class="app-container">
    <el-form
      :model="queryParams"
      ref="queryForm"
      :inline="true"
      v-show="showSearch"
      label-width="68px"
    >
      <el-form-item label="工单号" prop="orderNum">
        <el-input
          v-model="queryParams.orderNum"
          placeholder="请输入工单号"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button
          type="cyan"
          icon="el-icon-search"
          size="mini"
          @click="handleQuery"
          >搜索</el-button
        >
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
          >重置</el-button
        >
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['prodmanage:workreport:add']"
          >新增</el-button
        >
      </el-col>
            <el-col :span="1.5">
        <el-button
          type="success"
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="report"
          v-hasPermi="['prodmanage:workreport:report']"
          >报工</el-button
        >
      </el-col>
                  <el-col :span="1.5">
        <el-button
          type="success"
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="fcheck"
          v-hasPermi="['prodmanage:workreport:fcheck']"
          >首检</el-button
        >
      </el-col>
                
      <el-col :span="1.5">
        <el-button
          type="success"
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['prodmanage:workreport:edit']"
          >修改</el-button
        >
      </el-col>
      <!-- <el-col :span="1.5">
        <el-button
          type="danger"
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['prodmanage:workreport:remove']"
          >删除</el-button
        >
      </el-col> -->
      <el-col :span="1.5">
        <el-button
          type="warning"
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['prodmanage:workreport:export']"
          >导出</el-button
        >
      </el-col>
      <right-toolbar
        :showSearch.sync="showSearch"
        @queryTable="getList"
      ></right-toolbar>
    </el-row>

    <el-table
      v-loading="loading"
      :data="workreportList"
      @selection-change="handleSelectionChange"
      border
    >
      <el-table-column type="selection"  align="center" />
      <el-table-column
        label="操作"
        align="center"
        :show-overflow-tooltip="true"
        class-name="small-padding"
      >
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="details(scope.row)"
            v-hasPermi="['prodmanage:workreport:edit']"
             
            >详情</el-button
          >
        </template>
      </el-table-column>
      <el-table-column
        label="订单编号"
        align="center"
        prop="docNum"
        sortable
         :show-overflow-tooltip="true"
      />
      <el-table-column
        label="产品编码"
        align="center"
        prop="productCode"
        sortable
         :show-overflow-tooltip="true"
      />
      <el-table-column
        label="产品名称"
        align="center"
        prop="productName"
        sortable
         :show-overflow-tooltip="true"
      />
      <el-table-column
        label="规格型号"
        align="center"
        prop="specModel"
        sortable
         :show-overflow-tooltip="true"
      />
      <el-table-column
        label="数量"
        align="center"
        prop="quantity"
        sortable
         :show-overflow-tooltip="true"
      />
      <el-table-column
        label="单位"
        align="center"
        prop="unit"
        sortable
         :show-overflow-tooltip="true"
      />
      <el-table-column
        label="车间"
        align="center"
        prop="workshop"
        sortable
         :show-overflow-tooltip="true"
      />
      <el-table-column
        label="已报工数"
        align="center"
        prop="totalreportNum"
        sortable
         :show-overflow-tooltip="true"
      />

      <el-table-column
        label="已入库总数"
        align="center"
        prop="totalstoresNum"
        sortable
         :show-overflow-tooltip="true"
      />
      <el-table-column
        label="已入良品数"
        align="center"
        prop="goodNum"
        sortable
         :show-overflow-tooltip="true"
      />
      <el-table-column
        label="已入不良品数"
        align="center"
        prop="badNum"
        sortable
         :show-overflow-tooltip="true"
      />

      <!-- <el-table-column label="审核标志" align="center" prop="auditMark" />
      <el-table-column
        label="计划生产数量"
        align="center"
        prop="needQuantity"
      />
      <el-table-column
        label="排产日期"
        align="center"
        prop="planningDate"
        width="180"
      >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.planningDate, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
      <el-table-column
        label="开工日期"
        align="center"
        prop="startDate"
        width="180"
      >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.startDate, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
      <el-table-column
        label="完工日期"
        align="center"
        prop="endDate"
        width="180"
      >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.endDate, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
      <el-table-column label="审核状态" align="center" prop="auditStatus" />
      <el-table-column label="物料编码" align="center" prop="goodsCode" />
      <el-table-column
        label="单据状态(0正常，1挂起，2关闭)"
        align="center"
        prop="docStatus"
      />
      <el-table-column
        label="关闭状态(0未关闭1自动关闭,2手工关闭)"
        align="center"
        prop="closeStatus"
      />
      <el-table-column label="执行状态" align="center" prop="exeStatus" />
      <el-table-column
        label="工单类型(0正常，1超产，2返工)"
        align="center"
        prop="orderType"
      />
      <el-table-column
        label="记录上一次执行状态"
        align="center"
        prop="exeLasttime"
      />
      <el-table-column
        label="生产类型(0普通订单，1新增订单，2MRP拉取)"
        align="center"
        prop="prodType"
      />
      <el-table-column label="领料标识" align="center" prop="pickingMark" />
      <el-table-column label="入库标识" align="center" prop="inIden" />
      <el-table-column label="变更原因" align="center" prop="changeReason" />
      <el-table-column label="损耗率" align="center" prop="lossRate" />
      <el-table-column label="批号" align="center" prop="batchNum" />
      <el-table-column label="BOM编号" align="center" prop="bomCode" />
      <el-table-column label="成本对象" align="center" prop="costObject" />
      <el-table-column label="单据来源" align="center" prop="docSource" />
      <el-table-column label="计划订单号" align="center" prop="planorderNum" />
      <el-table-column label="销售订单号" align="center" prop="salesorderNum" />
      <el-table-column
        label="委托加工单位"
        align="center"
        prop="processCompany"
      />
      <el-table-column label="常用单位" align="center" prop="commonUnit" />
      <el-table-column label="工艺路线" align="center" prop="processRoute" />
      <el-table-column label="工单号" align="center" prop="orderNum" />
      <el-table-column
        label="常用单位数量"
        align="center"
        prop="commonunitNum"
      />
      <el-table-column label="实作数量" align="center" prop="implQuantity" />
      <el-table-column
        label="创建时间"
        align="center"
        prop="createTime"
        width="180"
      >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
      <el-table-column label="创建人" align="center" prop="createUser" />
      <el-table-column
        label="合格品入库数量"
        align="center"
        prop="qualifyinNum"
      />
      <el-table-column label="合格数量" align="center" prop="qualifyNum" />
      <el-table-column
        label="修改时间"
        align="center"
        prop="updateTime"
        width="180"
      >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.updateTime, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
      <el-table-column label="修改人" align="center" prop="updateUser" />
      <el-table-column label="因工报废数量" align="center" prop="workdueNum" />
      <el-table-column label="因料报废数量" align="center" prop="goodsdueNum" />
      <el-table-column label="备注" align="center" prop="remark" />
      <el-table-column label="遗失数量" align="center" prop="lostNum" />
      <el-table-column label="人工实作工时" align="center" prop="workHours" />
      <el-table-column
        label="机台准备工时"
        align="center"
        prop="preparationHours"
      />
      <el-table-column label="机台实作工时" align="center" prop="maworkHours" />
      <el-table-column
        label="单据下达日期"
        align="center"
        prop="issuanceDate"
        width="180"
      >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.issuanceDate, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
      <el-table-column
        label="实际开工日期"
        align="center"
        prop="realstartDate"
        width="180"
      >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.realstartDate, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
      <el-table-column
        label="实际完工日期"
        align="center"
        prop="realendDate"
        width="180"
      >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.realendDate, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
      <el-table-column label="下达人" align="center" prop="issueman" />
      <el-table-column label="结案人" align="center" prop="closeman" />
      <el-table-column
        label="结案日期"
        align="center"
        prop="closeDate"
        width="180"
      >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.closeDate, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
      <el-table-column
        label="上级任务单号"
        align="center"
        prop="taskorderNum"
      />
      <el-table-column label="预测单号" align="center" prop="forecastNum" />
      <el-table-column
        label="基本单位数量"
        align="center"
        prop="basicunitNum"
      />
      <el-table-column label="源单行号" align="center" prop="singlelineNum" />
      <el-table-column label="严格跟单标记" align="center" prop="strictMark" />
      <el-table-column
        label="补充库存标记"
        align="center"
        prop="replenishMark"
      />
      <el-table-column
        label="完工入库超收比例"
        align="center"
        prop="excessRate"
      />
      <el-table-column label="完工入库上限" align="center" prop="uplimit" />
      <el-table-column label="基本单位" align="center" prop="basicUnit" />
      <el-table-column
        label="完工入库上限"
        align="center"
        prop="basicUplimit"
      />
      <el-table-column
        label="完工入库上限"
        align="center"
        prop="commentUplimit"
      />
      <el-table-column
        label="完工入库欠收比例"
        align="center"
        prop="poorRate"
      />
      <el-table-column label="完工入库下限" align="center" prop="lowlimit" />
      <el-table-column
        label="完工入库下限"
        align="center"
        prop="basicLowlimit"
      />
      <el-table-column
        label="完工入库下限"
        align="center"
        prop="commentLowlimit"
      />
      <el-table-column label="变更次数" align="center" prop="changeNum" />
      <el-table-column label="计划模式" align="center" prop="planModel" />
      <el-table-column label="打印次数" align="center" prop="printNum" />
      <el-table-column label="计划跟踪号" align="center" prop="trackeNum" />
      <el-table-column
        label="人工准备工时"
        align="center"
        prop="prepareHours"
      />
      <el-table-column
        label="流转卡关联关闭"
        align="center"
        prop="associationClose"
      />
      <el-table-column
        label="财务结算标志"
        align="center"
        prop="financialMark"
      />
      <el-table-column label="财务结算人" align="center" prop="financialMan" />
      <el-table-column
        label="财务结算日期"
        align="center"
        prop="financialDate"
        width="180"
      >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.financialDate, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
      <el-table-column label="凭证字号" align="center" prop="voucherFont" />
      <el-table-column label="BOM类别" align="center" prop="bomClass" />
      <el-table-column
        label="请检关联数量"
        align="center"
        prop="pcassociateNum"
      />
      <el-table-column
        label="基本单位请检关联数量"
        align="center"
        prop="basicassociateNum"
      />
      <el-table-column label="返修数量" align="center" prop="repairnum" />
      <el-table-column
        label="基本单位返修数量"
        align="center"
        prop="basicRepairnum"
      />
      <el-table-column
        label="报废入库选单数量"
        align="center"
        prop="scrapmenuNum"
      />
      <el-table-column
        label="基本单位报入库选单数"
        align="center"
        prop="reportmenuNum"
      />
      <el-table-column label="报废入库数量" align="center" prop="scrapNum" />
      <el-table-column
        label="基本单位报废入库数量"
        align="center"
        prop="basicscrapNum"
      />
      <el-table-column label="样本破坏数量" align="center" prop="damageNum" />
      <el-table-column
        label="基本单位样本破坏数量"
        align="center"
        prop="basicdamageNum"
      />
      <el-table-column
        label="辅助属性名称"
        align="center"
        prop="secondaryName"
      />
      <el-table-column
        label="生产负责人"
        align="center"
        prop="prodResponsible"
      />
      <el-table-column
        label="作业排程引入"
        align="center"
        prop="jobIntroduce"
      />
      <el-table-column label="下达车间" align="center" prop="sendWorkshop" />
      <el-table-column label="等极品入库数" align="center" prop="goodsinNum" />
      <el-table-column label="客户名称" align="center" prop="customerName" />
      <el-table-column label="源单号" align="center" prop="sourceNum" />
      <el-table-column
        label="制单时间"
        align="center"
        prop="makeTime"
        width="180"
      >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.makeTime, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
      <el-table-column
        label="计划交货日期"
        align="center"
        prop="planDate"
        width="180"
      >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.planDate, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
      <el-table-column
        label="客户料号"
        align="center"
        prop="customergoodsCode"
      />
      <el-table-column
        label="生成下级任务单标志"
        align="center"
        prop="subordinateFlag"
      />
      <el-table-column label="上料数" align="center" prop="upgoodsNum" /> 

      <el-table-column label="来源" align="center" prop="source" />-->
    </el-table>

    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
    <!-- 详情页 -->
    <el-dialog
      :title="title"
      :visible.sync="open1"
      width="1300px"
      append-to-body
    >
      <el-form ref="form1" :model="form1" :rules="rules1" label-width="80px">
        <el-row>
           <el-col :span="6">
        <el-form-item label="订单编号" prop="docNum">
          <el-input v-model="form1.docNum" placeholder="请输入订单编号" :disabled="true"/>
        </el-form-item>
                  </el-col>
                    <el-col :span="6">
        <el-form-item label="单据来源" prop="docSource">
          <el-input v-model="form1.docSource" placeholder="请输入单据来源" :disabled="true"/>
        </el-form-item>
                  </el-col>
                    <el-col :span="6">
        <el-form-item label="销售订单" prop="salesorderNum">
          <el-input
            v-model="form1.salesorderNum"
            placeholder="请输入销售订单" :disabled="true"
          />
        </el-form-item>
                          </el-col>
                    <el-col :span="6">
        <el-form-item label="源单号" prop="sourceNum">
          <el-input v-model="form1.sourceNum" placeholder="请输入源单号" :disabled="true"/>
        </el-form-item>
          </el-col>
                  </el-row>

        <el-row>
           <el-col :span="6">
        <el-form-item label="产品编码" prop="productCode">
          <el-input v-model="form1.productCode" placeholder="请输入产品编码" :disabled="true"/>
        </el-form-item>
                  </el-col>
                    <el-col :span="6">
        <el-form-item label="产品名称" prop="productName">
          <el-input v-model="form1.productName" placeholder="请输入产品名称" :disabled="true"/>
        </el-form-item>
                  </el-col>
                    <el-col :span="6">
        <el-form-item label="规格型号" prop="specModel">
          <el-input v-model="form1.specModel" placeholder="请输入规格型号" :disabled="true"/>
        </el-form-item>
                  </el-col>
                    <el-col :span="6">
        <el-form-item label="客户料号" prop="customergoodsCode">
          <el-input
            v-model="form1.customergoodsCode"
            placeholder="请输入客户料号" :disabled="true"
          />
        </el-form-item>
          </el-col>
                  </el-row>


        <el-row>
           <el-col :span="6">
        <el-form-item label="单位" prop="unit">
          <el-input v-model="form1.unit" placeholder="请输入单位" :disabled="true"/>
        </el-form-item>
                  </el-col>
                    <el-col :span="6">
        <el-form-item
          label="生产类型"
          prop="prodType"
        >
          <el-select
            v-model="form1.prodType"
            placeholder="请选择生产类型" :disabled="true"
          >
            <el-option label="请选择字典生成" value=""  />
          </el-select>
        </el-form-item>
                  </el-col>
                    <el-col :span="6">
        <el-form-item label="BOM类别" prop="bomClass">
          <el-input v-model="form1.bomClass" placeholder="请输入BOM类别" :disabled="true"/>
        </el-form-item>
                  </el-col>
                    <el-col :span="6">
        <el-form-item label="bom版本" prop="bomVersion">
          <el-input v-model="form1.bomVersion" placeholder="请输入bom版本" :disabled="true"/>
        </el-form-item>
          </el-col>
                  </el-row>


                <el-row>
           <el-col :span="6">
        <el-form-item label="计生产数" prop="needQuantity">
          <el-input
            v-model="form.needQuantity"
            placeholder="请输入计生产数" :disabled="true"
          />
        </el-form-item>
                  </el-col>
                    <el-col :span="6">
        <el-form-item label="入库总数" prop="totalstoresNum">
          <el-input
            v-model="form1.totalstoresNum"
            placeholder="请输入入库总数" :disabled="true"
          />
        </el-form-item>
                  </el-col>
                    <el-col :span="6">
        <el-form-item label="车间" prop="workshop">
          <el-input v-model="form1.workshop" placeholder="请输入车间" :disabled="true"/>
        </el-form-item>
                  </el-col>
                    <el-col :span="6">
        <el-form-item label="需求数量" prop="quantity">
          <el-input v-model="form1.quantity" placeholder="请输入数量" :disabled="true"/>
        </el-form-item>
          </el-col>
                  </el-row>

                <el-row>
           <el-col :span="6">
        <el-form-item label="完工入库超收比例" prop="excessRate">
          <el-input
            v-model="form1.excessRate"
            placeholder="请输入完工入库超收比例" :disabled="true"
          />
        </el-form-item>
                  </el-col>
                    <el-col :span="6">
        <el-form-item label="完工入库上限" prop="uplimit">
          <el-input v-model="form1.uplimit" placeholder="请输入完工入库上限" :disabled="true"/>
        </el-form-item>
                  </el-col>
                    <el-col :span="6">
                <el-form-item label="完工入库下限" prop="lowlimit">
          <el-input v-model="form1.lowlimit" placeholder="请输入完工入库下限" :disabled="true"/>
        </el-form-item>
                  </el-col>
                    <el-col :span="6">
        <el-form-item label="完工入库欠收比例" prop="poorRate">
          <el-input
            v-model="form1.poorRate"
            placeholder="请输入完工入库欠收比例" :disabled="true"
          />
        </el-form-item>
      
          </el-col>
                  </el-row>


                <el-row>
           <el-col :span="6">
            <el-form-item label="计划订单" prop="planorderNum">
          <el-input
            v-model="form1.planorderNum"
            placeholder="请输入计划订单" :disabled="true"
          />
        </el-form-item>

                  </el-col>
                    <el-col :span="6">
        <el-form-item label="预测单号" prop="forecastNum">
          <el-input v-model="form1.forecastNum" placeholder="请输入预测单号" :disabled="true"/>
        </el-form-item>
                  </el-col>
                    <el-col :span="6">
        <el-form-item label="开工日期" prop="startDate">
          <el-date-picker
            clearable
            size="small"
            style="width: 230px"
            v-model="form1.startDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="选择开工日期" :disabled="true"
          >
          </el-date-picker>
        </el-form-item>
                  </el-col>
                    <el-col :span="6">
        <el-form-item label="完工日期" prop="endDate">
          <el-date-picker
            clearable
            size="small"
            style="width: 230px"
            v-model="form1.endDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="选择完工日期" :disabled="true"
          >
          </el-date-picker>
        </el-form-item>
          </el-col>
                  </el-row>

                <el-row>
           <el-col :span="6">
        <el-form-item label="实际开工" prop="realstartDate">
          <el-date-picker
            clearable
            size="small"
            style="width: 230px"
            v-model="form1.realstartDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="选择实际开工" :disabled="true"
          >
          </el-date-picker>
        </el-form-item>
                  </el-col>
                    <el-col :span="6">
        <el-form-item label="实际完工" prop="realendDate">
          <el-date-picker
            clearable
            size="small"
            style="width: 230px"
            v-model="form1.realendDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="选择实际完工" :disabled="true"
          >
          </el-date-picker>
        </el-form-item>
                  </el-col>
                    <el-col :span="6">
        <el-form-item label="单据状态">
          <el-radio-group v-model="form1.docStatus" :disabled="true">
            <el-radio label="1">请选择字典生成</el-radio>
          </el-radio-group>
        </el-form-item>
                  </el-col>
                    <el-col :span="6">
        <el-form-item label="成本对象" prop="costObject">
          <el-input v-model="form1.costObject" placeholder="请输入成本对象" :disabled="true"/>
        </el-form-item>
          </el-col>
                  </el-row>

                <el-row>
           <el-col :span="6">
        <el-form-item label="工艺路线" prop="processRoute">
          <el-input v-model="form1.processRoute" placeholder="请输入工艺路线" :disabled="true"/>
        </el-form-item>
                  </el-col>
                    <el-col :span="6">
        <el-form-item label="辅助属性" prop="secondaryName">
          <el-input
            v-model="form1.secondaryName"
            placeholder="请输入辅助属性" :disabled="true"
          />
        </el-form-item>
                  </el-col>
                    <el-col :span="6">
        <el-form-item label="客户名称" prop="customerName">
          <el-input v-model="form1.customerName" placeholder="请输入客户名称" :disabled="true"/>
        </el-form-item>
                  </el-col>
                    <el-col :span="6">
        <el-form-item label="制单时间" prop="makeTime">
          <el-date-picker
            clearable
            size="small"
            style="width: 230px"
            v-model="form1.makeTime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="选择制单时间" :disabled="true"
          >
          </el-date-picker>
        </el-form-item>
          </el-col>
                  </el-row>
                        <el-row>
           <el-col :span="6">
        <el-form-item label="制单人" prop="createUser">
          <el-input
            v-model="form1.createUser"
            placeholder="制单人" :disabled="true"
          />
        </el-form-item>
                  </el-col>
                    <el-col :span="6">
        <el-form-item label="下达人" prop="issueman">
          <el-input v-model="form1.issueman" placeholder="请输入下达人" :disabled="true"/>
        </el-form-item>
                  </el-col>
                    <el-col :span="6">
        <el-form-item label="下达日期" prop="issuanceDate">
          <el-date-picker
            clearable
            size="small"
            style="width: 230px"
            v-model="form1.issuanceDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="选择下达日期" :disabled="true"
          >
          </el-date-picker>
        </el-form-item>
                  </el-col>
                    <el-col :span="6">
        <el-form-item label="结案人" prop="closeman">
          <el-input v-model="form1.closeman" placeholder="请输入结案人" :disabled="true"/>
        </el-form-item>
          </el-col>
                  </el-row>

                                <el-row>
           <el-col :span="6">
        <el-form-item label="结案日期" prop="closeDate">
          <el-date-picker
            clearable
            size="small"
            style="width: 230px"
            v-model="form1.closeDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="选择结案日期" :disabled="true"
          >
          </el-date-picker>
        </el-form-item>

                  </el-col>
                    <el-col :span="6">
        <el-form-item label="批号" prop="batchNum">
          <el-input v-model="form1.batchNum" placeholder="请输入批号" :disabled="true"/>
        </el-form-item>
                  </el-col>
                    <el-col :span="6">
        <el-form-item label="计交货日" prop="planDate">
          <el-date-picker
            clearable
            size="small"
            style="width: 200px"
            v-model="form1.planDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="选择计交货日" :disabled="true"
          >
          </el-date-picker>
        </el-form-item>
          </el-col>
                  </el-row>
                <el-form-item label="备注" prop="remark">
          <el-input
            v-model="form1.remark"
            type="textarea"
            placeholder="请输入内容" :disabled="true"
          />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="cancel1">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 报工对话框 -->
    <el-dialog :title="title" :visible.sync="open2" width="500px" append-to-body>
      <el-form ref="form2" :model="form2" :rules="rules2" label-width="80px">
        <el-form-item label="工单号" prop="orderNum">
          <el-input v-model="form2.orderNum" placeholder="请输入工单号" :disabled="true"/>
        </el-form-item>
                <el-form-item label="计划生产数量" prop="needQuantity">
          <el-input
            v-model="form2.needQuantity"
            placeholder="请输入计划生产数量" :disabled="true"
          />
        </el-form-item>
        <el-form-item label="需求数量" prop="quantity">
          <el-input v-model="form2.quantity" placeholder="请输入数量" :disabled="true"/>
        </el-form-item>
        <el-form-item label="产品编码" prop="productCode">
          <el-input v-model="form2.productCode" placeholder="请输入产品编码" :disabled="true"/>
        </el-form-item>
        <el-form-item label="产品名称" prop="productName">
          <el-input v-model="form2.productName" placeholder="请输入产品名称" :disabled="true"/>
        </el-form-item>
                <el-form-item label="车间" prop="workshop">
          <el-input v-model="form2.workshop" placeholder="请输入车间" :disabled="true"/>
        </el-form-item>
        <el-form-item label="报工数" prop="alreadyreportNum">
          <el-input
            v-model="form2.alreadyreportNum"
            placeholder="请输入报工数"
          />
        </el-form-item>


      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="reportFrom">确 定</el-button>
        <el-button @click="cancel2">取 消</el-button>
      </div>
    </el-dialog>


    <!-- 添加或修改工单信息报工对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="订单编号" prop="docNum">
          <el-input v-model="form.docNum" placeholder="请输入订单编号" />
        </el-form-item>
        <el-form-item label="产品id" prop="productId">
          <el-input v-model="form.productId" placeholder="请输入产品id" />
        </el-form-item>
        <el-form-item label="产品编码" prop="productCode">
          <el-input v-model="form.productCode" placeholder="请输入产品编码" />
        </el-form-item>
        <el-form-item label="bom版本号" prop="bomVersion">
          <el-input v-model="form.bomVersion" placeholder="请输入bom版本号" />
        </el-form-item>
        <el-form-item label="产品名称" prop="productName">
          <el-input v-model="form.productName" placeholder="请输入产品名称" />
        </el-form-item>
        <el-form-item label="规格型号" prop="specModel">
          <el-input v-model="form.specModel" placeholder="请输入规格型号" />
        </el-form-item>
        <el-form-item label="单位" prop="unit">
          <el-input v-model="form.unit" placeholder="请输入单位" />
        </el-form-item>
        <el-form-item label="车间" prop="workshop">
          <el-input v-model="form.workshop" placeholder="请输入车间" />
        </el-form-item>
        <el-form-item label="审核标志" prop="auditMark">
          <el-input v-model="form.auditMark" placeholder="请输入审核标志" />
        </el-form-item>
        <el-form-item label="计划生产数量" prop="needQuantity">
          <el-input
            v-model="form.needQuantity"
            placeholder="请输入计划生产数量"
          />
        </el-form-item>
        <el-form-item label="数量" prop="quantity">
          <el-input v-model="form.quantity" placeholder="请输入数量" />
        </el-form-item>
        <el-form-item label="排产日期" prop="planningDate">
          <el-date-picker
            clearable
            size="small"
            style="width: 200px"
            v-model="form.planningDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="选择排产日期"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="开工日期" prop="startDate">
          <el-date-picker
            clearable
            size="small"
            style="width: 200px"
            v-model="form.startDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="选择开工日期"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="完工日期" prop="endDate">
          <el-date-picker
            clearable
            size="small"
            style="width: 200px"
            v-model="form.endDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="选择完工日期"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="审核状态">
          <el-radio-group v-model="form.auditStatus">
            <el-radio label="1">请选择字典生成</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="物料编码" prop="goodsCode">
          <el-input v-model="form.goodsCode" placeholder="请输入物料编码" />
        </el-form-item>
        <el-form-item label="单据状态(0正常，1挂起，2关闭)">
          <el-radio-group v-model="form.docStatus">
            <el-radio label="1">请选择字典生成</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="关闭状态(0未关闭1自动关闭,2手工关闭)">
          <el-radio-group v-model="form.closeStatus">
            <el-radio label="1">请选择字典生成</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="执行状态">
          <el-radio-group v-model="form.exeStatus">
            <el-radio label="1">请选择字典生成</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="工单类型(0正常，1超产，2返工)" prop="orderType">
          <el-select
            v-model="form.orderType"
            placeholder="请选择工单类型(0正常，1超产，2返工)"
          >
            <el-option label="请选择字典生成" value="" />
          </el-select>
        </el-form-item>
        <el-form-item label="记录上一次执行状态" prop="exeLasttime">
          <el-input
            v-model="form.exeLasttime"
            placeholder="请输入记录上一次执行状态"
          />
        </el-form-item>
        <el-form-item
          label="生产类型(0普通订单，1新增订单，2MRP拉取)"
          prop="prodType"
        >
          <el-select
            v-model="form.prodType"
            placeholder="请选择生产类型(0普通订单，1新增订单，2MRP拉取)"
          >
            <el-option label="请选择字典生成" value="" />
          </el-select>
        </el-form-item>
        <el-form-item label="领料标识" prop="pickingMark">
          <el-input v-model="form.pickingMark" placeholder="请输入领料标识" />
        </el-form-item>
        <el-form-item label="入库标识" prop="inIden">
          <el-input v-model="form.inIden" placeholder="请输入入库标识" />
        </el-form-item>
        <el-form-item label="变更原因" prop="changeReason">
          <el-input v-model="form.changeReason" placeholder="请输入变更原因" />
        </el-form-item>
        <el-form-item label="损耗率" prop="lossRate">
          <el-input v-model="form.lossRate" placeholder="请输入损耗率" />
        </el-form-item>
        <el-form-item label="批号" prop="batchNum">
          <el-input v-model="form.batchNum" placeholder="请输入批号" />
        </el-form-item>
        <el-form-item label="BOM编号" prop="bomCode">
          <el-input v-model="form.bomCode" placeholder="请输入BOM编号" />
        </el-form-item>
        <el-form-item label="成本对象" prop="costObject">
          <el-input v-model="form.costObject" placeholder="请输入成本对象" />
        </el-form-item>
        <el-form-item label="单据来源" prop="docSource">
          <el-input v-model="form.docSource" placeholder="请输入单据来源" />
        </el-form-item>
        <el-form-item label="计划订单号" prop="planorderNum">
          <el-input
            v-model="form.planorderNum"
            placeholder="请输入计划订单号"
          />
        </el-form-item>
        <el-form-item label="销售订单号" prop="salesorderNum">
          <el-input
            v-model="form.salesorderNum"
            placeholder="请输入销售订单号"
          />
        </el-form-item>
        <el-form-item label="委托加工单位" prop="processCompany">
          <el-input
            v-model="form.processCompany"
            placeholder="请输入委托加工单位"
          />
        </el-form-item>
        <el-form-item label="常用单位" prop="commonUnit">
          <el-input v-model="form.commonUnit" placeholder="请输入常用单位" />
        </el-form-item>
        <el-form-item label="工艺路线" prop="processRoute">
          <el-input v-model="form.processRoute" placeholder="请输入工艺路线" />
        </el-form-item>
        <el-form-item label="工单号" prop="orderNum">
          <el-input v-model="form.orderNum" placeholder="请输入工单号" />
        </el-form-item>
        <el-form-item label="常用单位数量" prop="commonunitNum">
          <el-input
            v-model="form.commonunitNum"
            placeholder="请输入常用单位数量"
          />
        </el-form-item>
        <el-form-item label="实作数量" prop="implQuantity">
          <el-input v-model="form.implQuantity" placeholder="请输入实作数量" />
        </el-form-item>
        <el-form-item label="合格品入库数量" prop="qualifyinNum">
          <el-input
            v-model="form.qualifyinNum"
            placeholder="请输入合格品入库数量"
          />
        </el-form-item>
        <el-form-item label="合格数量" prop="qualifyNum">
          <el-input v-model="form.qualifyNum" placeholder="请输入合格数量" />
        </el-form-item>
        <el-form-item label="因工报废数量" prop="workdueNum">
          <el-input
            v-model="form.workdueNum"
            placeholder="请输入因工报废数量"
          />
        </el-form-item>
        <el-form-item label="因料报废数量" prop="goodsdueNum">
          <el-input
            v-model="form.goodsdueNum"
            placeholder="请输入因料报废数量"
          />
        </el-form-item>
        <el-form-item label="备注" prop="remark">
          <el-input
            v-model="form.remark"
            type="textarea"
            placeholder="请输入内容"
          />
        </el-form-item>
        <el-form-item label="遗失数量" prop="lostNum">
          <el-input v-model="form.lostNum" placeholder="请输入遗失数量" />
        </el-form-item>
        <el-form-item label="人工实作工时" prop="workHours">
          <el-input v-model="form.workHours" placeholder="请输入人工实作工时" />
        </el-form-item>
        <el-form-item label="机台准备工时" prop="preparationHours">
          <el-input
            v-model="form.preparationHours"
            placeholder="请输入机台准备工时"
          />
        </el-form-item>
        <el-form-item label="机台实作工时" prop="maworkHours">
          <el-input
            v-model="form.maworkHours"
            placeholder="请输入机台实作工时"
          />
        </el-form-item>
        <el-form-item label="单据下达日期" prop="issuanceDate">
          <el-date-picker
            clearable
            size="small"
            style="width: 200px"
            v-model="form.issuanceDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="选择单据下达日期"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="实际开工日期" prop="realstartDate">
          <el-date-picker
            clearable
            size="small"
            style="width: 200px"
            v-model="form.realstartDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="选择实际开工日期"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="实际完工日期" prop="realendDate">
          <el-date-picker
            clearable
            size="small"
            style="width: 200px"
            v-model="form.realendDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="选择实际完工日期"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="下达人" prop="issueman">
          <el-input v-model="form.issueman" placeholder="请输入下达人" />
        </el-form-item>
        <el-form-item label="结案人" prop="closeman">
          <el-input v-model="form.closeman" placeholder="请输入结案人" />
        </el-form-item>
        <el-form-item label="结案日期" prop="closeDate">
          <el-date-picker
            clearable
            size="small"
            style="width: 200px"
            v-model="form.closeDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="选择结案日期"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="上级任务单号" prop="taskorderNum">
          <el-input
            v-model="form.taskorderNum"
            placeholder="请输入上级任务单号"
          />
        </el-form-item>
        <el-form-item label="预测单号" prop="forecastNum">
          <el-input v-model="form.forecastNum" placeholder="请输入预测单号" />
        </el-form-item>
        <el-form-item label="基本单位数量" prop="basicunitNum">
          <el-input
            v-model="form.basicunitNum"
            placeholder="请输入基本单位数量"
          />
        </el-form-item>
        <el-form-item label="源单行号" prop="singlelineNum">
          <el-input v-model="form.singlelineNum" placeholder="请输入源单行号" />
        </el-form-item>
        <el-form-item label="严格跟单标记" prop="strictMark">
          <el-input
            v-model="form.strictMark"
            placeholder="请输入严格跟单标记"
          />
        </el-form-item>
        <el-form-item label="补充库存标记" prop="replenishMark">
          <el-input
            v-model="form.replenishMark"
            placeholder="请输入补充库存标记"
          />
        </el-form-item>
        <el-form-item label="完工入库超收比例" prop="excessRate">
          <el-input
            v-model="form.excessRate"
            placeholder="请输入完工入库超收比例"
          />
        </el-form-item>
        <el-form-item label="完工入库上限" prop="uplimit">
          <el-input v-model="form.uplimit" placeholder="请输入完工入库上限" />
        </el-form-item>
        <el-form-item label="基本单位" prop="basicUnit">
          <el-input v-model="form.basicUnit" placeholder="请输入基本单位" />
        </el-form-item>
        <el-form-item label="完工入库上限" prop="basicUplimit">
          <el-input
            v-model="form.basicUplimit"
            placeholder="请输入完工入库上限"
          />
        </el-form-item>
        <el-form-item label="完工入库上限" prop="commentUplimit">
          <el-input
            v-model="form.commentUplimit"
            placeholder="请输入完工入库上限"
          />
        </el-form-item>
        <el-form-item label="完工入库欠收比例" prop="poorRate">
          <el-input
            v-model="form.poorRate"
            placeholder="请输入完工入库欠收比例"
          />
        </el-form-item>
        <el-form-item label="完工入库下限" prop="lowlimit">
          <el-input v-model="form.lowlimit" placeholder="请输入完工入库下限" />
        </el-form-item>
        <el-form-item label="完工入库下限" prop="basicLowlimit">
          <el-input
            v-model="form.basicLowlimit"
            placeholder="请输入完工入库下限"
          />
        </el-form-item>
        <el-form-item label="完工入库下限" prop="commentLowlimit">
          <el-input
            v-model="form.commentLowlimit"
            placeholder="请输入完工入库下限"
          />
        </el-form-item>
        <el-form-item label="变更次数" prop="changeNum">
          <el-input v-model="form.changeNum" placeholder="请输入变更次数" />
        </el-form-item>
        <el-form-item label="计划模式" prop="planModel">
          <el-input v-model="form.planModel" placeholder="请输入计划模式" />
        </el-form-item>
        <el-form-item label="打印次数" prop="printNum">
          <el-input v-model="form.printNum" placeholder="请输入打印次数" />
        </el-form-item>
        <el-form-item label="计划跟踪号" prop="trackeNum">
          <el-input v-model="form.trackeNum" placeholder="请输入计划跟踪号" />
        </el-form-item>
        <el-form-item label="人工准备工时" prop="prepareHours">
          <el-input
            v-model="form.prepareHours"
            placeholder="请输入人工准备工时"
          />
        </el-form-item>
        <el-form-item label="流转卡关联关闭" prop="associationClose">
          <el-input
            v-model="form.associationClose"
            placeholder="请输入流转卡关联关闭"
          />
        </el-form-item>
        <el-form-item label="财务结算标志" prop="financialMark">
          <el-input
            v-model="form.financialMark"
            placeholder="请输入财务结算标志"
          />
        </el-form-item>
        <el-form-item label="财务结算人" prop="financialMan">
          <el-input
            v-model="form.financialMan"
            placeholder="请输入财务结算人"
          />
        </el-form-item>
        <el-form-item label="财务结算日期" prop="financialDate">
          <el-date-picker
            clearable
            size="small"
            style="width: 200px"
            v-model="form.financialDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="选择财务结算日期"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="凭证字号" prop="voucherFont">
          <el-input v-model="form.voucherFont" placeholder="请输入凭证字号" />
        </el-form-item>
        <el-form-item label="BOM类别" prop="bomClass">
          <el-input v-model="form.bomClass" placeholder="请输入BOM类别" />
        </el-form-item>
        <el-form-item label="请检关联数量" prop="pcassociateNum">
          <el-input
            v-model="form.pcassociateNum"
            placeholder="请输入请检关联数量"
          />
        </el-form-item>
        <el-form-item label="基本单位请检关联数量" prop="basicassociateNum">
          <el-input
            v-model="form.basicassociateNum"
            placeholder="请输入基本单位请检关联数量"
          />
        </el-form-item>
        <el-form-item label="返修数量" prop="repairnum">
          <el-input v-model="form.repairnum" placeholder="请输入返修数量" />
        </el-form-item>
        <el-form-item label="基本单位返修数量" prop="basicRepairnum">
          <el-input
            v-model="form.basicRepairnum"
            placeholder="请输入基本单位返修数量"
          />
        </el-form-item>
        <el-form-item label="报废入库选单数量" prop="scrapmenuNum">
          <el-input
            v-model="form.scrapmenuNum"
            placeholder="请输入报废入库选单数量"
          />
        </el-form-item>
        <el-form-item label="基本单位报入库选单数" prop="reportmenuNum">
          <el-input
            v-model="form.reportmenuNum"
            placeholder="请输入基本单位报入库选单数"
          />
        </el-form-item>
        <el-form-item label="报废入库数量" prop="scrapNum">
          <el-input v-model="form.scrapNum" placeholder="请输入报废入库数量" />
        </el-form-item>
        <el-form-item label="基本单位报废入库数量" prop="basicscrapNum">
          <el-input
            v-model="form.basicscrapNum"
            placeholder="请输入基本单位报废入库数量"
          />
        </el-form-item>
        <el-form-item label="样本破坏数量" prop="damageNum">
          <el-input v-model="form.damageNum" placeholder="请输入样本破坏数量" />
        </el-form-item>
        <el-form-item label="基本单位样本破坏数量" prop="basicdamageNum">
          <el-input
            v-model="form.basicdamageNum"
            placeholder="请输入基本单位样本破坏数量"
          />
        </el-form-item>
        <el-form-item label="辅助属性名称" prop="secondaryName">
          <el-input
            v-model="form.secondaryName"
            placeholder="请输入辅助属性名称"
          />
        </el-form-item>
        <el-form-item label="生产负责人" prop="prodResponsible">
          <el-input
            v-model="form.prodResponsible"
            placeholder="请输入生产负责人"
          />
        </el-form-item>
        <el-form-item label="作业排程引入" prop="jobIntroduce">
          <el-input
            v-model="form.jobIntroduce"
            placeholder="请输入作业排程引入"
          />
        </el-form-item>
        <el-form-item label="下达车间" prop="sendWorkshop">
          <el-input v-model="form.sendWorkshop" placeholder="请输入下达车间" />
        </el-form-item>
        <el-form-item label="等极品入库数" prop="goodsinNum">
          <el-input
            v-model="form.goodsinNum"
            placeholder="请输入等极品入库数"
          />
        </el-form-item>
        <el-form-item label="客户名称" prop="customerName">
          <el-input v-model="form.customerName" placeholder="请输入客户名称" />
        </el-form-item>
        <el-form-item label="源单号" prop="sourceNum">
          <el-input v-model="form.sourceNum" placeholder="请输入源单号" />
        </el-form-item>
        <el-form-item label="制单时间" prop="makeTime">
          <el-date-picker
            clearable
            size="small"
            style="width: 200px"
            v-model="form.makeTime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="选择制单时间"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="计划交货日期" prop="planDate">
          <el-date-picker
            clearable
            size="small"
            style="width: 200px"
            v-model="form.planDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="选择计划交货日期"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="客户料号" prop="customergoodsCode">
          <el-input
            v-model="form.customergoodsCode"
            placeholder="请输入客户料号"
          />
        </el-form-item>
        <el-form-item label="生成下级任务单标志" prop="subordinateFlag">
          <el-input
            v-model="form.subordinateFlag"
            placeholder="请输入生成下级任务单标志"
          />
        </el-form-item>
        <el-form-item label="上料数" prop="upgoodsNum">
          <el-input v-model="form.upgoodsNum" placeholder="请输入上料数" />
        </el-form-item>
        <el-form-item label="总报工数" prop="totalreportNum">
          <el-input
            v-model="form.totalreportNum"
            placeholder="请输入总报工数"
          />
        </el-form-item>
        <el-form-item label="可用库存" prop="avaInventory">
          <el-input v-model="form.avaInventory" placeholder="请输入可用库存" />
        </el-form-item>
        <el-form-item label="已报工数" prop="alreadyreportNum">
          <el-input
            v-model="form.alreadyreportNum"
            placeholder="请输入已报工数"
          />
        </el-form-item>
        <el-form-item label="已入库总数" prop="totalstoresNum">
          <el-input
            v-model="form.totalstoresNum"
            placeholder="请输入已入库总数"
          />
        </el-form-item>
        <el-form-item label="已入良品数" prop="goodNum">
          <el-input v-model="form.goodNum" placeholder="请输入已入良品数" />
        </el-form-item>
        <el-form-item label="已入不良品数" prop="badNum">
          <el-input v-model="form.badNum" placeholder="请输入已入不良品数" />
        </el-form-item>
        <el-form-item label="来源" prop="source">
          <el-input v-model="form.source" placeholder="请输入来源" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>



<!-- 首检对话框 -->
    <el-dialog :title="title" :visible.sync="open3" width="500px" append-to-body>
      <el-form ref="form3" :model="form3" :rules="rules3" label-width="80px">

                <el-form-item label="良品状态" prop="docStatus">
          <el-select v-model="form3.fcheckType" placeholder="请选择良品状态">
            <el-option
              v-for="dict in docStatusOptions"
              :key="dict.dictValue"
              :label="dict.dictLabel"
              :value="parseInt(dict.dictValue)"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="工单号" prop="orderNum">
          <el-input v-model="form3.orderNum" placeholder="请输入工单号" :disabled="true"/>
        </el-form-item>
       <el-form-item label="产线" prop="prodLine">
          <el-input v-model="form3.prodLine" placeholder="请输入产线" :disabled="true"/>
        </el-form-item>
        <el-form-item label="产品编码" prop="productCode">
          <el-input v-model="form3.productCode" placeholder="请输入产品编码" :disabled="true"/>
        </el-form-item>
        <el-form-item label="产品名称" prop="productName">
          <el-input v-model="form3.productName" placeholder="请输入产品名称" :disabled="true"/>
        </el-form-item>
        <el-form-item label="开始时间" prop="planDate">
          <el-date-picker
            clearable
            size="small"
            style="width: 200px"
            v-model="form3.starttime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="开始时间" 
          >
          </el-date-picker>
        </el-form-item>
                <el-form-item label="结束时间" prop="planDate">
          <el-date-picker
            clearable
            size="small"
            style="width: 200px"
            v-model="form3.endtime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="结束时间" 
          >
          </el-date-picker>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="rcheckFrom">确 定</el-button>
        <el-button @click="cancel3">取 消</el-button>
      </div>
    </el-dialog>



  </div>
</template>

<script>
import {
  addReport,
  addFcheck,
  listWorkreport,
  getWorkreport,
  delWorkreport,
  addWorkreport,
  updateWorkreport,
  exportWorkreport,
} from "@/api/prodmanage/workreport";

export default {
  name: "Workreport",
  components: {},
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 工单信息报工表格数据
      workreportList: [],
      readyOptions: [],
      docStatusOptions: [] ,
      typeOptions: [] ,
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      open1: false,
      open2: false,
      open3:false,
      // 查询参数
      queryParams: {
pageNum: 1,
        pageSize: undefined,
        orderNum: undefined,
        docNum: undefined,
        productId: undefined,
        bomVersion: undefined,
        productCode: undefined,
        productName: undefined,
        specModel: undefined,
        unit: undefined,
        quantity: undefined,
        needQuantity: undefined,
        planningDate: undefined,
        lossRate: undefined,
        startDate: undefined,
        endDate: undefined,
        prodType: undefined,
        docStatus: undefined,
        auditStatus: undefined,
        closeStatus: undefined,
        orderType: undefined,
        exeStatus: undefined,
        pickingMark: undefined,
        inIden: undefined,
        exeLasttime: undefined,
        workshop: undefined,
        createTime: undefined,
        createUser: undefined,
        updateTime: undefined,
        changeReason: undefined,
        updateUser: undefined,
        isDel: undefined,
        remark: undefined,
        batchNum: undefined,
        bomCode: undefined,
        costObject: undefined,
        docSource: undefined,
        planorderNum: undefined,
        salesorderNum: undefined,
        processCompany: undefined,
        commonUnit: undefined,
        processRoute: undefined,
        goodsCode: undefined,
        basicUnit: undefined,
        basicunitNum: undefined,
        commonunitNum: undefined,
        implQuantity: undefined,
        qualifyinNum: undefined,
        qualifyNum: undefined,
        workdueNum: undefined,
        goodsdueNum: undefined,
        lostNum: undefined,
        workHours: undefined,
        preparationHours: undefined,
        maworkHours: undefined,
        issuanceDate: undefined,
        realstartDate: undefined,
        realendDate: undefined,
        issueman: undefined,
        closeman: undefined,
        closeDate: undefined,
        taskorderNum: undefined,
        forecastNum: undefined,
        singlelineNum: undefined,
        auditMark: undefined,
        strictMark: undefined,
        replenishMark: undefined,
        excessRate: undefined,
        uplimit: undefined,
        basicUplimit: undefined,
        commentUplimit: undefined,
        poorRate: undefined,
        lowlimit: undefined,
        basicLowlimit: undefined,
        commentLowlimit: undefined,
        changeNum: undefined,
        planModel: undefined,
        printNum: undefined,
        trackeNum: undefined,
        prepareHours: undefined,
        associationClose: undefined,
        financialMark: undefined,
        financialMan: undefined,
        financialDate: undefined,
        voucherFont: undefined,
        bomClass: undefined,
        pcassociateNum: undefined,
        basicassociateNum: undefined,
        repairnum: undefined,
        basicRepairnum: undefined,
        scrapmenuNum: undefined,
        reportmenuNum: undefined,
        scrapNum: undefined,
        basicscrapNum: undefined,
        damageNum: undefined,
        basicdamageNum: undefined,
        secondaryName: undefined,
        prodResponsible: undefined,
        jobIntroduce: undefined,
        sendWorkshop: undefined,
        goodsinNum: undefined,
        customerName: undefined,
        sourceNum: undefined,
        makeTime: undefined,
        planDate: undefined,
        customergoodsCode: undefined,
        subordinateFlag: undefined,
        upgoodsNum: undefined,
        totalreportNum: undefined,
        alreadyreportNum: undefined,
        totalstoresNum: undefined,
        totupgoodsNum: undefined,
        goodNum: undefined,
        badNum: undefined,
        source: undefined,
        avaInventory: undefined,
        packingCondition: undefined,
        reportType: undefined,
        inspectionStatus: undefined,
        prodLine: undefined,
        fcheckType: undefined,
        team: undefined,
        frequency: undefined,
                        starttime: undefined,
        endtime: undefined,
        isType: undefined
      },
      // 表单参数
      form: {},
      form1: {},
      form2: {},
      form3: {},
      // 表单校验
      rules: {},
      rules1: {},
      rules2: {},
      rules3: {},
    };
  },
  created() {
    this.getList();
        this.getDicts("qa_fcheck_doc_status").then(response => {
      this.docStatusOptions = response.data;
    });
  },
  methods: {
    /** 查询工单信息报工列表 */
    getList() {
      this.loading = true;
      listWorkreport(this.queryParams).then((response) => {
        this.workreportList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
        // 单据状态字典翻译
    docStatusFormat(row, column) {
      return this.selectDictLabel(this.docStatusOptions, row.docStatus);
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    cancel1() {
      this.open1 = false;
      this.reset1();
    },
        cancel2() {
      this.open2 = false;
      this.reset2();
    },
            cancel3() {
      this.open3 = false;
      this.reset3();
    },
    // 表单重置
    reset() {
      this.form = {
pageNum: 1,
        pageSize: undefined,
        orderNum: undefined,
        docNum: undefined,
        productId: undefined,
        bomVersion: undefined,
        productCode: undefined,
        productName: undefined,
        specModel: undefined,
        unit: undefined,
        quantity: undefined,
        needQuantity: undefined,
        planningDate: undefined,
        lossRate: undefined,
        startDate: undefined,
        endDate: undefined,
        prodType: undefined,
        docStatus: undefined,
        auditStatus: undefined,
        closeStatus: undefined,
        orderType: undefined,
        exeStatus: undefined,
        pickingMark: undefined,
        inIden: undefined,
        exeLasttime: undefined,
        workshop: undefined,
        createTime: undefined,
        createUser: undefined,
        updateTime: undefined,
        changeReason: undefined,
        updateUser: undefined,
        isDel: undefined,
        remark: undefined,
        batchNum: undefined,
        bomCode: undefined,
        costObject: undefined,
        docSource: undefined,
        planorderNum: undefined,
        salesorderNum: undefined,
        processCompany: undefined,
        commonUnit: undefined,
        processRoute: undefined,
        goodsCode: undefined,
        basicUnit: undefined,
        basicunitNum: undefined,
        commonunitNum: undefined,
        implQuantity: undefined,
        qualifyinNum: undefined,
        qualifyNum: undefined,
        workdueNum: undefined,
        goodsdueNum: undefined,
        lostNum: undefined,
        workHours: undefined,
        preparationHours: undefined,
        maworkHours: undefined,
        issuanceDate: undefined,
        realstartDate: undefined,
        realendDate: undefined,
        issueman: undefined,
        closeman: undefined,
        closeDate: undefined,
        taskorderNum: undefined,
        forecastNum: undefined,
        singlelineNum: undefined,
        auditMark: undefined,
        strictMark: undefined,
        replenishMark: undefined,
        excessRate: undefined,
        uplimit: undefined,
        basicUplimit: undefined,
        commentUplimit: undefined,
        poorRate: undefined,
        lowlimit: undefined,
        basicLowlimit: undefined,
        commentLowlimit: undefined,
        changeNum: undefined,
        planModel: undefined,
        printNum: undefined,
        trackeNum: undefined,
        prepareHours: undefined,
        associationClose: undefined,
        financialMark: undefined,
        financialMan: undefined,
        financialDate: undefined,
        voucherFont: undefined,
        bomClass: undefined,
        pcassociateNum: undefined,
        basicassociateNum: undefined,
        repairnum: undefined,
        basicRepairnum: undefined,
        scrapmenuNum: undefined,
        reportmenuNum: undefined,
        scrapNum: undefined,
        basicscrapNum: undefined,
        damageNum: undefined,
        basicdamageNum: undefined,
        secondaryName: undefined,
        prodResponsible: undefined,
        jobIntroduce: undefined,
        sendWorkshop: undefined,
        goodsinNum: undefined,
        customerName: undefined,
        sourceNum: undefined,
        makeTime: undefined,
        planDate: undefined,
        customergoodsCode: undefined,
        subordinateFlag: undefined,
        upgoodsNum: undefined,
        totalreportNum: undefined,
        alreadyreportNum: undefined,
        totalstoresNum: undefined,
        totupgoodsNum: undefined,
        goodNum: undefined,
        badNum: undefined,
        source: undefined,
        avaInventory: undefined,
        packingCondition: undefined,
        reportType: undefined,
        inspectionStatus: undefined,
        prodLine: undefined,
        fcheckType: undefined,
        team: undefined,
        frequency: undefined,
                starttime: undefined,
        endtime: undefined,
        isType: undefined
      };
      this.resetForm("form");
    },

    reset1() {
      this.form1 = {
        pageNum: 1,
        pageSize: undefined,
        orderNum: undefined,
        docNum: undefined,
        productId: undefined,
        bomVersion: undefined,
        productCode: undefined,
        productName: undefined,
        specModel: undefined,
        unit: undefined,
        quantity: undefined,
        needQuantity: undefined,
        planningDate: undefined,
        lossRate: undefined,
        startDate: undefined,
        endDate: undefined,
        prodType: undefined,
        docStatus: undefined,
        auditStatus: undefined,
        closeStatus: undefined,
        orderType: undefined,
        exeStatus: undefined,
        pickingMark: undefined,
        inIden: undefined,
        exeLasttime: undefined,
        workshop: undefined,
        createTime: undefined,
        createUser: undefined,
        updateTime: undefined,
        changeReason: undefined,
        updateUser: undefined,
        isDel: undefined,
        remark: undefined,
        batchNum: undefined,
        bomCode: undefined,
        costObject: undefined,
        docSource: undefined,
        planorderNum: undefined,
        salesorderNum: undefined,
        processCompany: undefined,
        commonUnit: undefined,
        processRoute: undefined,
        goodsCode: undefined,
        basicUnit: undefined,
        basicunitNum: undefined,
        commonunitNum: undefined,
        implQuantity: undefined,
        qualifyinNum: undefined,
        qualifyNum: undefined,
        workdueNum: undefined,
        goodsdueNum: undefined,
        lostNum: undefined,
        workHours: undefined,
        preparationHours: undefined,
        maworkHours: undefined,
        issuanceDate: undefined,
        realstartDate: undefined,
        realendDate: undefined,
        issueman: undefined,
        closeman: undefined,
        closeDate: undefined,
        taskorderNum: undefined,
        forecastNum: undefined,
        singlelineNum: undefined,
        auditMark: undefined,
        strictMark: undefined,
        replenishMark: undefined,
        excessRate: undefined,
        uplimit: undefined,
        basicUplimit: undefined,
        commentUplimit: undefined,
        poorRate: undefined,
        lowlimit: undefined,
        basicLowlimit: undefined,
        commentLowlimit: undefined,
        changeNum: undefined,
        planModel: undefined,
        printNum: undefined,
        trackeNum: undefined,
        prepareHours: undefined,
        associationClose: undefined,
        financialMark: undefined,
        financialMan: undefined,
        financialDate: undefined,
        voucherFont: undefined,
        bomClass: undefined,
        pcassociateNum: undefined,
        basicassociateNum: undefined,
        repairnum: undefined,
        basicRepairnum: undefined,
        scrapmenuNum: undefined,
        reportmenuNum: undefined,
        scrapNum: undefined,
        basicscrapNum: undefined,
        damageNum: undefined,
        basicdamageNum: undefined,
        secondaryName: undefined,
        prodResponsible: undefined,
        jobIntroduce: undefined,
        sendWorkshop: undefined,
        goodsinNum: undefined,
        customerName: undefined,
        sourceNum: undefined,
        makeTime: undefined,
        planDate: undefined,
        customergoodsCode: undefined,
        subordinateFlag: undefined,
        upgoodsNum: undefined,
        totalreportNum: undefined,
        alreadyreportNum: undefined,
        totalstoresNum: undefined,
        totupgoodsNum: undefined,
        goodNum: undefined,
        badNum: undefined,
        source: undefined,
        avaInventory: undefined,
        packingCondition: undefined,
        reportType: undefined,
        inspectionStatus: undefined,
        prodLine: undefined,
        fcheckType: undefined,
        team: undefined,
        frequency: undefined,
                starttime: undefined,
        endtime: undefined,
        isType: undefined
      };
      this.resetForm("form1");
    },

     reset2() {
      this.form2 = {
        pageNum: 1,
        pageSize: undefined,
        orderNum: undefined,
        docNum: undefined,
        productId: undefined,
        bomVersion: undefined,
        productCode: undefined,
        productName: undefined,
        specModel: undefined,
        unit: undefined,
        quantity: undefined,
        needQuantity: undefined,
        planningDate: undefined,
        lossRate: undefined,
        startDate: undefined,
        endDate: undefined,
        prodType: undefined,
        docStatus: undefined,
        auditStatus: undefined,
        closeStatus: undefined,
        orderType: undefined,
        exeStatus: undefined,
        pickingMark: undefined,
        inIden: undefined,
        exeLasttime: undefined,
        workshop: undefined,
        createTime: undefined,
        createUser: undefined,
        updateTime: undefined,
        changeReason: undefined,
        updateUser: undefined,
        isDel: undefined,
        remark: undefined,
        batchNum: undefined,
        bomCode: undefined,
        costObject: undefined,
        docSource: undefined,
        planorderNum: undefined,
        salesorderNum: undefined,
        processCompany: undefined,
        commonUnit: undefined,
        processRoute: undefined,
        goodsCode: undefined,
        basicUnit: undefined,
        basicunitNum: undefined,
        commonunitNum: undefined,
        implQuantity: undefined,
        qualifyinNum: undefined,
        qualifyNum: undefined,
        workdueNum: undefined,
        goodsdueNum: undefined,
        lostNum: undefined,
        workHours: undefined,
        preparationHours: undefined,
        maworkHours: undefined,
        issuanceDate: undefined,
        realstartDate: undefined,
        realendDate: undefined,
        issueman: undefined,
        closeman: undefined,
        closeDate: undefined,
        taskorderNum: undefined,
        forecastNum: undefined,
        singlelineNum: undefined,
        auditMark: undefined,
        strictMark: undefined,
        replenishMark: undefined,
        excessRate: undefined,
        uplimit: undefined,
        basicUplimit: undefined,
        commentUplimit: undefined,
        poorRate: undefined,
        lowlimit: undefined,
        basicLowlimit: undefined,
        commentLowlimit: undefined,
        changeNum: undefined,
        planModel: undefined,
        printNum: undefined,
        trackeNum: undefined,
        prepareHours: undefined,
        associationClose: undefined,
        financialMark: undefined,
        financialMan: undefined,
        financialDate: undefined,
        voucherFont: undefined,
        bomClass: undefined,
        pcassociateNum: undefined,
        basicassociateNum: undefined,
        repairnum: undefined,
        basicRepairnum: undefined,
        scrapmenuNum: undefined,
        reportmenuNum: undefined,
        scrapNum: undefined,
        basicscrapNum: undefined,
        damageNum: undefined,
        basicdamageNum: undefined,
        secondaryName: undefined,
        prodResponsible: undefined,
        jobIntroduce: undefined,
        sendWorkshop: undefined,
        goodsinNum: undefined,
        customerName: undefined,
        sourceNum: undefined,
        makeTime: undefined,
        planDate: undefined,
        customergoodsCode: undefined,
        subordinateFlag: undefined,
        upgoodsNum: undefined,
        totalreportNum: undefined,
        alreadyreportNum: undefined,
        totalstoresNum: undefined,
        totupgoodsNum: undefined,
        goodNum: undefined,
        badNum: undefined,
        source: undefined,
        avaInventory: undefined,
        packingCondition: undefined,
        reportType: undefined,
        inspectionStatus: undefined,
        prodLine: undefined,
        fcheckType: undefined,
        team: undefined,
        frequency: undefined,
                starttime: undefined,
        endtime: undefined,
        isType: undefined
      };
      this.resetForm("form2");
    },
         reset3() {
      this.form3 = {
        pageNum: 1,
        pageSize: undefined,
        orderNum: undefined,
        docNum: undefined,
        productId: undefined,
        bomVersion: undefined,
        productCode: undefined,
        productName: undefined,
        specModel: undefined,
        unit: undefined,
        quantity: undefined,
        needQuantity: undefined,
        planningDate: undefined,
        lossRate: undefined,
        startDate: undefined,
        endDate: undefined,
        prodType: undefined,
        docStatus: undefined,
        auditStatus: undefined,
        closeStatus: undefined,
        orderType: undefined,
        exeStatus: undefined,
        pickingMark: undefined,
        inIden: undefined,
        exeLasttime: undefined,
        workshop: undefined,
        createTime: undefined,
        createUser: undefined,
        updateTime: undefined,
        changeReason: undefined,
        updateUser: undefined,
        isDel: undefined,
        remark: undefined,
        batchNum: undefined,
        bomCode: undefined,
        costObject: undefined,
        docSource: undefined,
        planorderNum: undefined,
        salesorderNum: undefined,
        processCompany: undefined,
        commonUnit: undefined,
        processRoute: undefined,
        goodsCode: undefined,
        basicUnit: undefined,
        basicunitNum: undefined,
        commonunitNum: undefined,
        implQuantity: undefined,
        qualifyinNum: undefined,
        qualifyNum: undefined,
        workdueNum: undefined,
        goodsdueNum: undefined,
        lostNum: undefined,
        workHours: undefined,
        preparationHours: undefined,
        maworkHours: undefined,
        issuanceDate: undefined,
        realstartDate: undefined,
        realendDate: undefined,
        issueman: undefined,
        closeman: undefined,
        closeDate: undefined,
        taskorderNum: undefined,
        forecastNum: undefined,
        singlelineNum: undefined,
        auditMark: undefined,
        strictMark: undefined,
        replenishMark: undefined,
        excessRate: undefined,
        uplimit: undefined,
        basicUplimit: undefined,
        commentUplimit: undefined,
        poorRate: undefined,
        lowlimit: undefined,
        basicLowlimit: undefined,
        commentLowlimit: undefined,
        changeNum: undefined,
        planModel: undefined,
        printNum: undefined,
        trackeNum: undefined,
        prepareHours: undefined,
        associationClose: undefined,
        financialMark: undefined,
        financialMan: undefined,
        financialDate: undefined,
        voucherFont: undefined,
        bomClass: undefined,
        pcassociateNum: undefined,
        basicassociateNum: undefined,
        repairnum: undefined,
        basicRepairnum: undefined,
        scrapmenuNum: undefined,
        reportmenuNum: undefined,
        scrapNum: undefined,
        basicscrapNum: undefined,
        damageNum: undefined,
        basicdamageNum: undefined,
        secondaryName: undefined,
        prodResponsible: undefined,
        jobIntroduce: undefined,
        sendWorkshop: undefined,
        goodsinNum: undefined,
        customerName: undefined,
        sourceNum: undefined,
        makeTime: undefined,
        planDate: undefined,
        customergoodsCode: undefined,
        subordinateFlag: undefined,
        upgoodsNum: undefined,
        totalreportNum: undefined,
        alreadyreportNum: undefined,
        totalstoresNum: undefined,
        totupgoodsNum: undefined,
        goodNum: undefined,
        badNum: undefined,
        source: undefined,
        avaInventory: undefined,
        packingCondition: undefined,
        reportType: undefined,
        inspectionStatus: undefined,
        prodLine: undefined,
        fcheckType: undefined,
        team: undefined,
        frequency: undefined,
                starttime: undefined,
        endtime: undefined,
        isType: undefined
      };
      this.resetForm("form3");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.workorderId);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
      this.readyOptions = selection;
      this.typeOptions = selection;
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加工单信息报工";
    },


        /** 报工按钮操作 */
    report(row) {
      this.reset2();
      const workorderId = row.workorderId || this.ids;
            var isLock = this.readyOptions.map((item) => item.exeStatus)[0];
            if(isLock == 0 || isLock == 1 || isLock == 3 || isLock == 5)
            {
                this.msgSuccess("当前状态不能报工");
                  return;
            }
      getWorkreport(workorderId).then((response) => {
        this.form2 = response.data;
        this.open2 = true;
        this.title = "报工";
      });
    },
    
        /** 首检按钮操作 */
            fcheck(row) {
      this.reset3();
        var istype = this.typeOptions.map((item) => item.fcheckType)[0];
        if(istype == 1)
        {
            this.msgSuccess("该工单首检过，请勿重复首检");
                  return;
        }
      const workorderId = row.workorderId || this.ids;
      getWorkreport(workorderId).then((response) => {
        this.form3 = response.data;
        this.open3 = true;
        this.title = "首检";
      });
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const workorderId = row.workorderId || this.ids;
      getWorkreport(workorderId).then((response) => {
        this.form = response.data;
        this.open = true;
        this.title = "修改工单信息报工";
      });
    },
    /** 详情按钮操作 */
    details(row) {
      this.reset1();
      const workorderId = row.workorderId || this.ids;
      getWorkreport(workorderId).then((response) => {
        this.form1 = response.data;
        this.open1 = true;
        this.title = "详情页";
      });
    },
    /** 报工提交按钮 */
    reportFrom() {
      this.$refs["form2"].validate((valid) => {
        if (valid) {
            addReport(this.form2).then((response) => {
              this.msgSuccess("新增成功");
              this.open2 = false;
              this.getList();
            });
        }
      });
    },
        /** 首检提交按钮 */
    rcheckFrom() {
      this.$refs["form3"].validate((valid) => {
        if (valid) {
            addFcheck(this.form3).then((response) => {
              this.msgSuccess("新增成功");
              this.open3 = false;
              this.getList();
            });
        }
      });
    },



    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          if (this.form.workorderId != null) {
            updateWorkreport(this.form).then((response) => {
              this.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addWorkreport(this.form).then((response) => {
              this.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const workorderIds = row.workorderId || this.ids;
      this.$confirm(
        '是否确认删除工单信息报工编号为"' + workorderIds + '"的数据项?',
        "警告",
        {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        }
      )
        .then(function () {
          return delWorkreport(workorderIds);
        })
        .then(response => {
          this.getList();
          this.msgSuccess(response.msg);
        });
    },
    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams;
      this.$confirm("是否确认导出所有工单信息报工数据项?", "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(function () {
          return exportWorkreport(queryParams);
        })
        .then((response) => {
          this.download(response.msg);
        });
    },
  },
};
</script>
